package cn.itcast.mapper;



import cn.itcast.DTO.PageQueryDTO;
import cn.itcast.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    // 新增
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user (name,age,sex,phone,user_number) values(#{name},#{age},#{sex},#{phone},#{userNumber})")
    void add(User user);

    // 查询
    @Select("select * from user where id = #{id}")
    User findById(Integer id);

    // 分页查询
    List<User> page(PageQueryDTO dto);

    // 更新
    void update(User user);

    // 删除
    @Delete("delete from user where id = #{id}")
    void delete(Integer id);
}
